package org.rockNarwhal.controller;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("")
public class PageController {

    @RequestMapping("index")
    public String index(){
        return "main";
    }

    @RequiresPermissions("deleteOrder")//设置访问权限
    @RequestMapping("/deleteOrder")
    public String deleteOrder(){
        return "deleteOrder";
    }

    @RequiresRoles("admin")//访问角色限制
    @RequestMapping("/deleteProduct")
    public String deleteProduct(){
        return "deleteProduct";
    }

    @RequestMapping("/listProduct")
    public String listProduct(){
        return "listProduct";
    }

    @RequestMapping(value="/login",method= RequestMethod.GET)
    public String login(){
        return "login";
    }

    @RequestMapping("/unauthorized")//没有访问权限跳转的页面
    public String noPerms(){
        return "unauthorized";
    }
}
